import {configureStore} from "@reduxjs/toolkit";

// 引入redux模块定义的reducer函数
import appSlice from "./appSlice";
import userSlice from "@/pages/Login/slice";

// 集中式存储数据的仓库
// 所有redux状态数据都存在store中
// TODO：汇总所有redux模块reducer函数，将来就能读取/更新对应redux模块的数据
export const store = configureStore({
    reducer: {
        app: appSlice,
        user: userSlice
    },
    middleware: (getDefaultMiddleware) =>
        // 忽略序列化检查
        getDefaultMiddleware({
            serializableCheck: false
        })
});

export type AppDispatch = typeof store.dispatch;
export type RootState = ReturnType<typeof store.getState>;
